package cn.easy.mortgage.beetl;

import cn.easy.base.SpringContext;
import cn.easy.mortgage.domain.Channel;
import cn.easy.mortgage.service.ChannelService;
import org.beetl.core.Context;
import org.beetl.core.Function;

import static cn.easy.base.utils.SpringSecurityUtils.getCurrentUserId;

public class CurrentChannel implements Function {
    @Override
    public Object call(Object[] paras, Context ctx) {
        ChannelService channelService = SpringContext.getBean(ChannelService.class);

        Channel channel = channelService.findByUserId(getCurrentUserId());
        return channel;
    }
}
